package ModeLayer;
import java.util.ArrayList;

/**
 * Write a description of class Forest here.
 * Forest1
 * @author () 
 * @version (11-03-2013)
 */
/**
 *
 */
public class Forest
{
 private String name;
 private String location;
 private double squareMetre;
 private String natureOfTrees;
 private double pricePrSquareMetre;
 /**
  *
  */
 private Owner forestOwner;
 //Possible more than one tree
 private ArrayList<Tree> myTree;

/**
 * 
 */
 
public Forest(String NewName, String NewLocation, double NewSquareMetre, String NewNatureOfTrees, double NewPricePrSquareMetre)
{
  name = NewName;
  location = NewLocation;
  squareMetre = NewSquareMetre;
  natureOfTrees = NewNatureOfTrees;
  pricePrSquareMetre = NewPricePrSquareMetre;
  forestOwner = null;
  myTree = new ArrayList<Tree>();
}

public Forest()
{
  name = null;
  location = null;   
  squareMetre = 0;
  natureOfTrees = null;
  pricePrSquareMetre = 0;
  forestOwner = null;
  myTree = new ArrayList<Tree>();
}

/**
 *
 */
public void addOwner(Owner forestOwner)
{
 this.forestOwner = forestOwner;
}


/**
 * 
 */
public void addTree(Tree treeType)
{
 myTree.add(treeType);
}

/**
 * 
 */
public void changeName(String NewName)
{
 name = NewName;
}

public String getName()
{
 return name;
}



public void changeLocation(String NewLocation)
{
 location = NewLocation;
}

public String getLocation()
{
 return location;
}



public void changeSquareMetre(double NewSquareMetre)
{
 squareMetre = NewSquareMetre;
}

public double getSquareMetre()
{
 return squareMetre;
}



public void changeNatureOfTrees(String NewNatureOfTrees)
{
 natureOfTrees = NewNatureOfTrees;
}

public String getNatureOfTrees()
{
 return natureOfTrees;
}
public Owner getOwner()
{
    return forestOwner;
}


public void ChangePricePrSquareMeter(double NewPrice)
{
 pricePrSquareMetre = NewPrice;
}

public double getPricePrSquareMetre()
{
 return pricePrSquareMetre;
}

/**
 *
 */
public double getForestCost()
{
    double cost = 0;
    for(Tree treeType :myTree){
       cost += (squareMetre/1000000) * treeType.getCostPrSquareKilometre();
    }
    return cost;
}

/**
 * 
 */
public double calculateForestRevenue()
{
    double revenue = 0;
    for(Tree treeType :myTree){
        revenue += treeType.getRevenuePrSquareKilometre() * (squareMetre/1000000);
    }
    return revenue;
}

/**
 * 
 */

public double CalculateProfit()
{
    double profit = 0;
    for(Tree treeType : myTree)
    {
     profit +=  (treeType.getRevenuePrSquareKilometre() * (squareMetre/1000000)) - ((squareMetre/1000000) * treeType.getCostPrSquareKilometre());

    }
    return profit;
}


}

    
    
    
    
 
    
    
    
    
    
    

